<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">

<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>中国(太原)煤炭交易中心-煤炭交易平台</TITLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/bootstrap/css/bootstrap.min.css">
   <!-- Font Awesome -->
    <link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/ionicons/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/dist/css/AdminLTE.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="<s:url value="/resources"/>/adminlte/plugins/iCheck/square/blue.css">
    <script src="<s:url value="/resources"/>/js/jquery.js" type="text/javascript"></script>
    <script src="<s:url value="/resources"/>/js/jquery-ui.js" type="text/javascript"></script>
<SCRIPT language=javascript type=text/javascript>
        function check() {
            if (document.getElementById("userName").value.length < 1) {
                alert('请输入用户名！');
                document.getElementById("userName").focus(); //获得焦点
                return false;
            }if (document.getElementById("password").value.length < 1) {
                alert('请输入密码！');
                document.getElementById("password").focus(); //获得焦点
                return false;
            }
            loginform.method="post";
            loginform.action="<s:url value="/login/logon"/>";
            loginform.submit();
        }

        $(function () {
            $("#userName").focus();
            $("#selapp").click(function () {
                var menu = $(this).next().show().position({
                    my: "left top",
                    at: "left bottom",
                    of: this
                });
                $(document).one("click", function () {
                    menu.hide();
                });
                return false;
            })
          .next()
            .hide()
            .menu();
        
         })
         
          function AlterCheckCode() {            
            var url = "<s:url value="/"/>/login/validateCode";           
            $("#CCImage").attr("src", url);
        }
         
</SCRIPT>
</HEAD>
<body class="hold-transition login-page">
	<div class="login-box">
      <div class="login-logo">
        大数据系统登录
      </div><!-- /.login-logo -->
      <div class="login-box-body">
        <p class="login-box-msg"></p>
        <form  method="post" name="loginform" id="loginform" onkeypress="if( event.keyCode == 13 ) {check();}">
          <div class="form-group has-feedback">
            <input  class="form-control" placeholder="用户名" id="userName" name="loginname" type="text" maxlength="18" value="${loginname}" >
            <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
          </div>
          <div class="form-group has-feedback">
            <input type="password" class="form-control" placeholder="密码" id="password" name="password">
            <span class="glyphicon glyphicon-lock form-control-feedback"></span>
          </div>
          <div class="form-group has-feedback">
            <input type="text" class="form-control" placeholder="验证码" style="width:65%; float: left" name="validateCode">
            <img src="<s:url value="/login/validateCode"/>"  id="CCImage" style="vertical-align:middle;width:30%;float: right " onclick="AlterCheckCode();" alt="请输入验证码" title="看不清换一张" />
          </div>
          <div class="row form-group" style="margin:0 auto;margin:60px auto 10px auto;">
             <button id="go" class="btn btn-block  btn-facebook btn-flat" style="float:left;width:49%;margin-top: 5px;" onclick="check()">
                登录</button>                                     
             <button id="A1" class="btn btn-block  btn-google btn-flat" style="float:right;width:49%;" onclick="$('#loginform').reset();">
       	重置</button> 
               
          </div>
        </form>
		
                                        <input type="hidden" value="${flag}" />
                                        <c:if test="${result=='1'}">
                                            <font color="red">&nbsp;&nbsp;*&nbsp;&nbsp;提示:验证码不正确！</font>
	                                        </c:if>
	                                        <c:if test="${result=='2'}">
	                                          <font color="red">&nbsp;&nbsp;*&nbsp;&nbsp;提示:用户名或者密码不正确！</font>
	                                        </c:if>
	                                        <c:if test="${result=='3'}">
	                                           <font color="red">&nbsp;&nbsp;*&nbsp;&nbsp;提示:网关服务器信息不完整,请重试！</font>
	                                        </c:if>
      </div><!-- /.login-box-body -->
    </div><!-- /.login-box -->
     
    <script language="javascript" for="document" event="onkeydown">
    if (event.keyCode == 13){//敲击回车键
        document.getElementById("go").click();
        
    }
      
    </script>
    
    
</body>
